/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, {Component} from "react";
import {Image, StyleSheet, Text, TouchableOpacity, View} from "react-native";
import GCStyle from "../../../Model/Global/GCStyle";
import GCComponent from "../../../Model/Global/GCComponent";
import {connect} from 'react-redux';
import Global from '../../../Model/Global/GCPublic';
class SelfInfo extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: this.setData([])
        }
    }

    setData(jsonData) {
        return [
            {title: '商业名称', content: jsonData.info || '诚华股份有限公司'},
            {title: '营业驾照号码', content: jsonData.info || '54352093432443234'},
            {title: '资质证书编号', content: jsonData.info || '54674569435045'},
            {title: '联系人', content: jsonData.info || '万建'},
            {title: '手机号码', content: jsonData.info || '1568****949'},
            {title: '绑定银行用户', content: jsonData.info || '452**********1456'},
        ];
    }

    render() {
        return (
            <View style={styles.container}>
                <View style={GCStyle.Style.navigatorView}>
                    <TouchableOpacity onPress={() => this.onClickBack(0)}>
                        <Image resizeMode='contain' source={require('../../../Resource/Imgs/nav_backoff.png')}
                               style={GCStyle.Style.LeftBn}/>
                    </TouchableOpacity>
                    <Text style={GCStyle.Style.titleTxt}>认证资料</Text>
                    <View style={[GCStyle.Style.rightBn, {justifyContent: 'center'}]}/>
                </View>
                <View
                    style={[GCStyle.GCOrderCell.cellLine, {
                        paddingLeft: 10,
                        paddingRight: 10,
                        width: GCStyle.GCPubWidth
                    }]}
                >
                    <Text style={{fontSize: 14, color: '#000000'}}>商业名称</Text>
                    <Text style={[GCStyle.Style.greyTxt, {flex: 1, textAlign: 'right', marginRight: 6}]}>
                        {Global.User.name}
                    </Text>
                    {GCComponent.lineAction(47, 0)}
                </View>
                <View
                    style={[GCStyle.GCOrderCell.cellLine, {
                        paddingLeft: 10,
                        paddingRight: 10,
                        width: GCStyle.GCPubWidth
                    }]}
                >
                    <Text style={{fontSize: 14, color: '#000000'}}>营业驾照号码</Text>
                    <Text style={[GCStyle.Style.greyTxt, {flex: 1, textAlign: 'right', marginRight: 6}]}>
                        {Global.User.business_licence}
                    </Text>
                    {GCComponent.lineAction(47, 0)}
                </View>
                <View
                    style={[GCStyle.GCOrderCell.cellLine, {
                        paddingLeft: 10,
                        paddingRight: 10,
                        width: GCStyle.GCPubWidth
                    }]}
                >
                    <Text style={{fontSize: 14, color: '#000000'}}>资质证书编号</Text>
                    <Text style={[GCStyle.Style.greyTxt, {flex: 1, textAlign: 'right', marginRight: 6}]}>
                        {Global.User.certificate}
                    </Text>
                    {GCComponent.lineAction(47, 0)}
                </View>
                <View
                    style={[GCStyle.GCOrderCell.cellLine, {
                        paddingLeft: 10,
                        paddingRight: 10,
                        width: GCStyle.GCPubWidth
                    }]}
                >
                    <Text style={{fontSize: 14, color: '#000000'}}>联系人</Text>
                    <Text style={[GCStyle.Style.greyTxt, {flex: 1, textAlign: 'right', marginRight: 6}]}>
                        {Global.User.name}
                    </Text>
                    {GCComponent.lineAction(47, 0)}
                </View>
                <View
                    style={[GCStyle.GCOrderCell.cellLine, {
                        paddingLeft: 10,
                        paddingRight: 10,
                        width: GCStyle.GCPubWidth
                    }]}
                >
                    <Text style={{fontSize: 14, color: '#000000'}}>手机号码</Text>
                    <Text style={[GCStyle.Style.greyTxt, {flex: 1, textAlign: 'right', marginRight: 6}]}>
                        {Global.User.mobile}
                    </Text>
                    {GCComponent.lineAction(47, 0)}
                </View>
                <View
                    style={[GCStyle.GCOrderCell.cellLine, {
                        paddingLeft: 10,
                        paddingRight: 10,
                        width: GCStyle.GCPubWidth
                    }]}
                >
                    <Text style={{fontSize: 14, color: '#000000'}}>绑定银行用户</Text>
                    <Text style={[GCStyle.Style.greyTxt, {flex: 1, textAlign: 'right', marginRight: 6}]}>
                        {Global.User.corporate_bankno}
                    </Text>
                    {GCComponent.lineAction(47, 0)}
                </View>
            </View>
        );
    }

    onClickBack() {
        const {navigator} = this.props;
        if (navigator) {
            navigator.pop();
        }
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        backgroundColor: '#F4F4F4',

    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
});

export default connect((state) => {
    return {UserReducer} = state;
})(SelfInfo);